package com.java.multipledatasource.registered;

import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author hu
 * @version 1.0
 * @date 2020/12/30 0030 下午 2:53
 * @description
 */
@Service
public class PhoneRegisteredParamCheckService  implements RegisteredParamCheckService{

    @Autowired
    private UserService userService;

    @Override
    public boolean checkCode(byte code) {
        return RegisteredEnums.PHONE.getCode() == code;
    }

    @Override
    public void checkByFieldRules(Object obj) {
        PhoneRegisteredEntity phoneRegisteredEntity = (PhoneRegisteredEntity) obj;
        //todo 账号密码填写
    }

    @Override
    public void checkIsExist(Object obj) {
        PhoneRegisteredEntity phoneRegisteredEntity = (PhoneRegisteredEntity) obj;
        userService.checkByPhone(phoneRegisteredEntity.getPhone());
    }
}
